{include file="public/header"}
<body>
<style>


</style>
<fieldset class="layui-elem-field">
    <legend><span style="color: #58a;">{$agent['name']}</span> 的激活码汇总</legend>
    <div class="layui-field-box">
        <table class="layui-table" lay-even>
            <thead>
            <tr>
                <th>ID</th>
                <th>激活码</th>
                <th>状态</th>
                <th>激活客户Id</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody  id="searchContent">
            {volist name="list" id="vo"}
            <tr>
                <td>{$vo['id']}</td>
                <td>{$vo['key']}</td>
                <td>
                    {if condition="$vo['is_active'] == 0"}
                        <span style="border-radius: 2px;background-color: #FF5722;padding:5px 10px;color: #ffffff">未激活</span>
                    {else /}
                        <span style="border-radius: 2px;background-color: #5FB878;padding:5px 10px;color: #ffffff">已激活</span>
                    {/if}
                </td>
                <td>{$vo['uid']}</td>
                <td width="25%">
                    <span class="layui-btn confirm" data-id="{$vo['id']}" data-info="你确定此激活码么?" data-url="{:url('del')}">删除</span>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>


        {$list->render()}
    </div>
</fieldset>


{include file="public/footer"}
<script>
    layui.use(['layer'], function() {
        $('#searchContent .detail').on('click', function () {
            var ownObj = $(this);
            layer.open({
                type: 2,
                area: ['90%', '90%'],
                maxmin: true,
                content: ownObj.attr('data-url')
            });
        });
        $('#searchContent .confirm').on('click', function () {
            var ownObj = $(this);
            layer.confirm(ownObj.attr('data-info'), {
                btn: ['确定','取消'] //按钮
            }, function(){
                var params  = {
                    url: ownObj.attr('data-url'),
                    data: {id:ownObj.attr('data-id')},
                    type: 'post',
                    sCallback:function(res){
                        layer.msg(res.msg,{time:1800},function(){
                            location.reload();
                            parent.location.reload();
                        });
                    }
                };
                common.request(params);
            });
        });
    });
</script>
</body>
</html>